package com.qfedu.knowledge.entity.bo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.qfedu.knowledge.entity.enums.HandleEnum;
import lombok.*;

/**
 * @ClassName QuestionRecord
 * 题目修改记录
 * @Author ykx
 * @Date 2024/1/16 11:07
 * @Version 1.0
 */
@EqualsAndHashCode(callSuper = false)
@TableName("kn_question_record_t")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class QuestionRecordBO extends BaseColumn {
    /**
     * id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 题目id
     */
    @TableField("question_id")
    private Long questionId;

    /**
     * 处理记录
     */
    @TableField("handle_result")
    private String handleResult;

    /**
     * 处理类型
     */
    @TableField("handle_type")
    private String handleType;


    /**
     * 更新问题单后，插入流程进展记录
     *
     * @param questionId   questionId
     * @param handleResult handleResult
     * @return QuestionRecordBO
     */
    public static QuestionRecordBO createRecordForUpdInfo(Long questionId, String handleResult) {
        return QuestionRecordBO.builder()
                .questionId(questionId)
                .handleType(HandleEnum.UPD_QUESTION_INFO.getHandleType())
                .handleResult(handleResult)
                .build();
    }

}
